package cn.tth.test.game.mysql;

import lombok.extern.slf4j.Slf4j;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

@Slf4j
public abstract class BaseMapper<T> implements IMapper<T> {

    private Class<T> obj;

    public void executeQuery(String sql){
        MysqlConnectPoll poll = MysqlConnectPoll.getInstance();
        MysqlConnectPoll.ConnectionContext connection = poll.getConnection();
        try {
            Statement statement = connection.getConnection().createStatement();
            ResultSet rs = statement.executeQuery(sql);
            while (rs.next()){
                System.out.println(rs.getString(1));
                System.out.println(rs.getString(2));
                System.out.println(rs.getString(3));
                System.out.println(rs.getString(4));
                System.out.println(rs.getString(5));
                System.out.println(rs.getString(6));
                System.out.println(rs.getString(7));
            }
        }catch (SQLException e){
            log.warn("error:",e);
        }
    }

}
